package com.ice.work.moment.ticket.service;

import com.alicp.jetcache.anno.CacheInvalidate;
import com.alicp.jetcache.anno.Cached;
import com.honeybee.cloud.framework.base.exception.business.BaseBizException;
import com.ice.work.moment.facade.ticket.dto.CookieDTO;
import com.ice.work.moment.facade.ticket.model.Cookie;

/**
 * @Description user
 * @Author DELL
 * @Create 2019-05-16
 * @Since 1.0.0
 */
public interface ICookieService {
    String KEY = "COOKIE_";

    /**
     * 查询
     *
     * @param loginName
     * @return
     * @throws BaseBizException
     */
    CookieDTO findByLoginName(String loginName) throws BaseBizException;

    /**
     * 查询
     *
     * @param appKey
     * @return
     * @throws BaseBizException
     */
    @Cached(name = KEY, key = "#appKey")
    CookieDTO findByAppKey(String appKey) throws BaseBizException;

    /**
     * 保存
     *
     * @param cookie
     * @return
     * @throws BaseBizException
     */
    boolean add(Cookie cookie) throws BaseBizException;

    /**
     * 删除
     *
     * @param appKey
     * @return
     * @throws BaseBizException
     */
    @CacheInvalidate(name = KEY, key = "#appKey")
    void deleteByAppKey(String appKey) throws BaseBizException;
}
